<template>
	<view>
		<view>
			<form @submit="formSubmit" @reset="formReset">
				<view class="uni-form-item uni-column absolute">
					<view class="title">{{questionsinfo.question}}</view>
					<view name="radio" class="p10 bg_white">
						<view class="pB10" v-for="(item,index) in questionsinfo.options">
							<radio :disabled="true"  :checked="questionsinfo.answer === item.value" value="radio+index" />
							<text>{{item.name}}</text>
						</view>						
					</view>
				</view>
			</form>
		</view>
		<!-- 底部导航 -->
		<footernav pagePath='user'></footernav>
		<!-- 加载动画 -->
		<loading v-if="!isloading()"></loading>
	</view>
</template>
<script>
export default {
	data() {
		return {
			n: 2,
			m: 1,
			questionsinfo:{},
			options:{}
		};
	},
	onLoad(options){

		if(options.questionsinfo){
			this.questionsinfo = JSON.parse(options.questionsinfo)
			this.options =  JSON.parse(JSON.parse(options.optionsinfo))
			this.questionsinfo.options = JSON.parse(JSON.parse(options.optionsinfo))
			// this.options = this.questionsinfo.options.split(","); //字符分割
			// this.options = JSON.parse(questionsinfo.options)
			console.log(this.options )
		}
		console.log(this.questionsinfo)
	},
	methods: {
		
		formSubmit: function(e) {
			uni.navigateTo({
				// url: '/pages/shouquan/yingye'
				url: '/pages/subject/answerResults'
			});
			console.log(1)
			return
			console.log('form发生了submit事件，携带数据为：' + JSON.stringify(e.detail.value));
			var formdata = e.detail.value;
			uni.showModal({
				content: '表单数据内容：' + JSON.stringify(formdata),
				showCancel: false
			});
		},
		formReset: function(e) {
			console.log('清空数据');
		}
	}
};
</script>

<style>
.top-title {
	margin: 10px 0 0 10px;
}
.uni-form-item .title {
	padding: 20rpx 10px;
}
uni-radio-group,
uni-checkbox-group {
	width: 100%;
	/* justify-content: space-between; */
	/* margin-left: 10%; */
	display: flex;
	justify-content: space-around;
}
.submit {
	position: relative;
	display: block;
	margin-left: 10px;
	margin-right: 10px;
	padding-left: 14px;
	padding-right: 14px;
	box-sizing: border-box;
	font-size: 18px;
	text-align: center;
	text-decoration: none;
	line-height: 2.55555556;
	border-radius: 5px;
	-webkit-tap-highlight-color: transparent;
	overflow: hidden;
	color: #000;
	background-color: #f8f8f8;
	cursor: pointer;
	bottom: 10px;
	color: rgba(255, 255, 255, 1);
	background-color: rgba(42, 130, 228, 1);
	border-radius: 5px;
	font-size: 15px;
}
</style>
